<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitPage extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pages', function (Blueprint $table) {
            $table->comment = '自定义页面';

            $table->increments('id');
            $table->uuid('uuid')->index() ;

            $table->string('title')->nullable()->comment('页面标题');
            $table->date('display_time')->nullable()->comment('显示日期');

            $table->json('content')->nullable()->comment('页面内容，包含页面模块和样式等');
            $table->integer('visit_total')->default(1)->comment('访问数量');

            $table->integer('list_weight')->default(100)->index()->comment('列表权重');
            $table->tinyInteger('status')->default(1)->index()->comment('0为未上架 1为已上架'); // 0为未上架 1为已上架 

            $table->softDeletes();
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::dropIfExists('pages');
    }
}
